var formOpt = function(){
	var obj = {};
	obj.formToObject = function(formObj){
		var object = {};
		var t = $(formObj).serializeArray();
		$.each(t,function(){
			if(this.name == "sal"){
				object[this.name] = Number(this.value);
			}else if(this.name == "birth"){
				object[this.name] = this.value;
			}else if(this.name == "sex"){
				if(this.value=="true"){
					object[this.name] = true;
				}else{
					object[this.name] = false;
				}
			}else{
				object[this.name] = this.value;
			}
		});
		//alert(JSON.stringify(object));
		return object;
	}
	return obj;
}();


function FormatDate (strTime) {
	    var date = new Date(strTime);
	    return date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate();
}



var customerHandler=function(){
	var obj = {};
	
	obj.deleteCustomer = function(cid, callback){
		AjaxOpt.post("delete_async","cid="+cid , callback);
	}
	
	obj.addCustomer = function(user, callback){
		AjaxOpt.postJson("add_async",user, callback);
	}
	
	obj.updateCustomer = function(user,callback){
		////更新Customer
		AjaxOpt.postJson("update_async",user, callback);
	}
	
	return obj;
}();
